<h1><%- t('Search Results') %>: <%- query %></h1>
<p>This search is provided by the elastic search module, based on <a href='http://www.elasticsearch.org/'>http://www.elasticsearch.org/</a>.  Features are slowly being added, so if you get strange behaviour please do report it via github.</p>
<div class="search-results">
  <div class="facets">
    <% 
      for(var facet in facets) {            
    %>
      <div class="facet">  
        <h3><%- facet %></h3>
        
        <% if(facets[facet]._type === 'terms') { %>
        <ul>
          <% facets[facet].terms.forEach(function(term) { %>
              <li><%- term.term %> (<%- term.count %>)</li>
          <% }); %>
        </ul>
        <% } %>
        
        <% if(facets[facet]._type === 'date_histogram') { %>
        <ul>
          <% facets[facet].entries.forEach(function(term) {             
          %>
              <li><%- prettyDate(new Date(term.time)) %> (<%- term.count %>)</li>
          <% }); %>
        </ul>
        <% } %>
        
      </div>
    <% }; %>  
  </div>
  <div class="results">  
    <% 
      hits.forEach(function(item) {
        
        var result = item._source;   
    %>
    <div class='search-list-item'>
        <h2><a href='/<%= result.alias %>.html'><%- result.title %></a></h2>
        <p><%- result.teaser %> ... <a href='/<%= result.alias %>.html'>more</a></p>
    </div>
    <% });  %>
  </div>
  <div style="clear:both"></div>
</div>
<%- pager %>